package cn.aloxc.tianya.reader;

import android.app.Activity;
import android.database.Cursor;
import android.net.Uri;
import android.os.Bundle;
import android.provider.Contacts.People;
import android.provider.ContactsContract.Contacts;
import android.widget.ListAdapter;
import android.widget.ListView;
import android.widget.SimpleCursorAdapter;

@SuppressWarnings("deprecation")
public class Activity_test_list_cursor extends Activity{
	ListView lv = null;
	public void onCreate(Bundle savedInstanceState){
		super.onCreate(savedInstanceState);
		//setContentView(R.layout.activity_test_list_cursor);
        Bundle data = this.getIntent().getExtras();
        setTitle(data.getString("testItem"));
        lv = new ListView(this);
        String uriString = "content://contacts/people/"; 
        Cursor cursor = managedQuery(Uri.parse(uriString),null,null,null,null);
        //Cursor cursor = getContentResolver().query(People.CONTENT_URI, null, null, null, null);
        startManagingCursor(cursor);
        ListAdapter adapter = new SimpleCursorAdapter(
        		this,R.layout.activity_test_list_cursor,
        		cursor,new String[]{People.NAME,People.NUMBER},
        		new int[]{R.id.test_list_cursor_name,R.id.test_list_cursor_number}
        );
        lv.setAdapter(adapter);
        setContentView(lv);
        
	}
}
